package com.heiko.myopenglrecord2

import android.content.Context
import android.opengl.GLES20

class MyFilter(context: Context) : AbstractFilter(context, R.raw.camera_vert, R.raw.camera_frag) {

    private var mtx: FloatArray? = null
    private var vMatrix = 0

    init {
        vMatrix = GLES20.glGetUniformLocation(program, "vMatrix")
    }

    override fun onDraw(texture: Int): Int {
        return super.onDraw(texture)
    }

    override fun beforeDraw() {
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
        GLES20.glUniformMatrix4fv(vMatrix, 1, false, mtx, 0)
    }

    fun setTransformMatrix(mtx: FloatArray) {
        this.mtx = mtx
    }
}
